package com.smartStatus.api.feign;

import com.smartStatus.api.entity.SysUser;
import com.smartStatus.core.constant.SecurityConstant;
import com.smartStatus.core.constant.UserInfo;
import com.smartStatus.core.util.R;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestHeader;
import sun.security.util.SecurityConstants;

/**
 * @ClassName : RemoteUserService
 * @Author : lby
 * @Date: 2021/1/26 17:24
 * @Description : 远程调用user
 */
@FeignClient(contextId = "remoteUserService", value = "smart-status-upms-blz")
public interface RemoteUserService {

    /**
     * 根据id获取用户
     */
    @PostMapping("/sysUser/get-user-by-name")
    R<SysUser> getUserInfo(SysUser sysUser);


    /**
     * 获取用户个人信息
     *
     * @param username
     * @param from
     * @return
     */
    @GetMapping("/sysUser/info/{username}")
    R<UserInfo> info(@PathVariable("username") String username, @RequestHeader(SecurityConstant.FROM) String from);


    /**
     * 用户使用社交账号登陆
     *
     * @param inStr
     * @param fromIn
     * @return
     */
    @GetMapping("/sysUser/social/{inStr}")
    R<UserInfo> social(@PathVariable("inStr") String inStr, @RequestHeader(SecurityConstant.FROM_IN) String fromIn);


    /**
     * 删除缓存中的key
     *
     * @param fromIn
     * @return
     */
    @GetMapping("/menu/del-cache-menu/{userId}")
    R deleteMenuTree(@PathVariable("userId") Integer userId, @RequestHeader(SecurityConstant.FROM_IN) String fromIn);

}